package de.fhkl.imst.i.cgma.raytracer.geometry;

public class Translation extends Transformation {

	/** Translation vector. */
	private float[] vector;

	/**
	 * Translationmatrix with vector as adjustment.
	 * 
	 * @param vector translation vector
	 */
	public Translation(float[] vector) {
		super();

		this.vector = vector;

		matrix[0] = new float[] { 1, 0, 0, vector[0] };
		matrix[1] = new float[] { 0, 1, 0, vector[1] };
		matrix[2] = new float[] { 0, 0, 1, vector[2] };
		matrix[3] = new float[] { 0, 0, 0, 1 };
	}

	@Override
	public Transformation inverse() {
		return new Translation(new float[] { -vector[0], -vector[1], -vector[2] });
	}

}
